Fix memory leaks.
authoroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 29 Apr 2006 21:57:05 +0000 (21:57 +0000)
committeroliskoli <oliskoli@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Sat, 29 Apr 2006 21:57:05 +0000 (21:57 +0000)
gpsbabel/interpolate.c

index f5a1d9c4ae4e12882e2a84ff0df7fd28d09a00df..f054ae4a47f1dad03fbda96bb572b15b5d222d71 100644 (file)
@@ -83,12 +83,9 @@ interpfilt_process(void)
                                        timen += interval ) {
                                waypoint *wpt_new = waypt_dupe(wpt);
                                wpt_new->creation_time = timen;
-                               xfree(wpt_new->shortname);
-                               if (wpt_new->description) {
-                                   xfree(wpt_new->description);
-                                   wpt_new->description = NULL;
-                               }
-                               wpt_new->shortname = wpt_new->description = 0;
+                               if (wpt_new->shortname) xfree(wpt_new->shortname);
+                               if (wpt_new->description) xfree(wpt_new->description);
+                               wpt_new->shortname = wpt_new->description = NULL;
                                linepart( lat1, lon1, 
                                          wpt->latitude, wpt->longitude,
                                          (double)(timen-time1)/
@@ -112,12 +109,9 @@ interpfilt_process(void)
                                waypoint *wpt_new = waypt_dupe(wpt);
                                wpt_new->creation_time = distn/curdist*
                                        (wpt->creation_time - time1) + time1;
-                               xfree(wpt_new->shortname);
-                               if (wpt_new->description) {
-                                   xfree(wpt_new->description);
-                                   wpt_new->description = NULL;
-                               }
-                               wpt_new->shortname = wpt_new->description = 0;
+                               if (wpt_new->shortname) xfree(wpt_new->shortname);
+                               if (wpt_new->description) xfree(wpt_new->description);
+                               wpt_new->shortname = wpt_new->description = NULL;
                                linepart( lat1, lon1, 
                                          wpt->latitude, wpt->longitude,
                                          distn/curdist,